
from . import models
from dynamic_rest import serializers


class CASSerializer(serializers.DynamicModelSerializer):
    compound = serializers.DynamicRelationField('CompoundSerializer')

    class Meta:
        model = models.CAS
        exclude = []


class CIDSerializer(serializers.DynamicModelSerializer):
    compound = serializers.DynamicRelationField('CompoundSerializer')

    class Meta:
        model = models.CID
        exclude = []


class ChEMBLSerializer(serializers.DynamicModelSerializer):
    chembl_assay_id_set = serializers.DynamicRelationField('ChEMBL_Assay_idSerializer', many=True, deferred=True)
    compound = serializers.DynamicRelationField('CompoundSerializer')

    class Meta:
        model = models.ChEMBL
        exclude = []


class ChEMBL_Assay_idSerializer(serializers.DynamicModelSerializer):
    chembl_id = serializers.DynamicRelationField('ChEMBLSerializer')

    class Meta:
        model = models.ChEMBL_Assay_id
        exclude = []


class ChineseIdentitySerializer(serializers.DynamicModelSerializer):
    compound = serializers.DynamicRelationField('CompoundSerializer')

    class Meta:
        model = models.ChineseIdentity
        exclude = []


class CompoundSerializer(serializers.DynamicModelSerializer):
    cas = serializers.DynamicRelationField('CASSerializer', many=True, deferred=True)
    chembl_set = serializers.DynamicRelationField('ChEMBLSerializer', many=True, deferred=True)
    chineseidentity_set = serializers.DynamicRelationField('ChineseIdentitySerializer', many=True, deferred=True)
    cid = serializers.DynamicRelationField('CIDSerializer', many=True, deferred=True)
    englishidentity_set = serializers.DynamicRelationField('EnglishIdentitySerializer', many=True, deferred=True)
    keggsimilarity_set = serializers.DynamicRelationField('KEGGSimilaritySerializer', many=True, deferred=True)

    class Meta:
        model = models.Compound
        exclude = []


class EnglishIdentitySerializer(serializers.DynamicModelSerializer):
    compound = serializers.DynamicRelationField('CompoundSerializer')

    class Meta:
        model = models.EnglishIdentity
        exclude = []


class HerbSerializer(serializers.DynamicModelSerializer):
    herb_set = serializers.DynamicRelationField('HerbSerializer', many=True, deferred=True)
    related_herbs = serializers.DynamicRelationField('HerbSerializer')
    taxonomy = serializers.DynamicRelationField('TCMTaxonomySerializer')

    class Meta:
        model = models.Herb
        exclude = []


class KEGGCompoundSerializer(serializers.DynamicModelSerializer):
    keggsimilarity_set = serializers.DynamicRelationField('KEGGSimilaritySerializer', many=True, deferred=True)

    class Meta:
        model = models.KEGGCompound
        exclude = []


class KEGGPathwaySerializer(serializers.DynamicModelSerializer):
    category = serializers.DynamicRelationField('KEGGPathwayCategorySerializer')

    class Meta:
        model = models.KEGGPathway
        exclude = []


class KEGGSimilaritySerializer(serializers.DynamicModelSerializer):
    kegg_compound = serializers.DynamicRelationField('KEGGCompoundSerializer')
    tcm = serializers.DynamicRelationField('CompoundSerializer')

    class Meta:
        model = models.KEGGSimilarity
        exclude = []


class PrescriptionSerializer(serializers.DynamicModelSerializer):
    main_prescription = serializers.DynamicRelationField('PrescriptionSerializer')
    prescription_set = serializers.DynamicRelationField('PrescriptionSerializer', many=True, deferred=True)

    class Meta:
        model = models.Prescription
        exclude = []


